package com.sjzd.discoveryclient.eureka;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@EnableFeignClients
@SpringBootApplication
@RestController
@RequestMapping("/mclient01")
public class EurekaClient01 {

    @Autowired
    private IRemoteService remoteService;

    public static void main(String[] args) {
        SpringApplication.run(EurekaClient01.class, args);
    }

    @GetMapping("/hello")
    public String hello() {
        return remoteService.hello();
    }

    @GetMapping("/error")
    public String error() {
        return remoteService.error();
    }

    @GetMapping("/echo")
    public String error(String command) {
        return remoteService.echo(command);
    }

    @RequestMapping("/user")
    public String user(@RequestBody ClientUser user) {
        return remoteService.user(user);
    }

    @GetMapping("/gateway/hello")
    public String gatewayHello() {
        return "gateway hello";
    }
}
